package com.ff.discounts.component.main

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.ff.discounts.component.tab.home.HomeFragment
import com.ff.discounts.component.tab.me.MeFragment
import com.ff.discounts.component.tab.charge.SquareFragment

/**
 *
 * @author: fufang
 * @date: 2023/10/17
 */
class MainAdapter(fragmentActivity: FragmentActivity,private val count:Int):FragmentStateAdapter(fragmentActivity) {
    override fun getItemCount(): Int {
        return count
    }

    override fun createFragment(position: Int): Fragment {
        return when(position){
            1 -> SquareFragment.newInstance()
            2 -> MeFragment.newInstance()
            else -> HomeFragment.newInstance()
        }
    }
}